package com.example.logistics_oa.controller;

import com.example.comment_oa.pojos.xinzi.JibenGongzidan;
import com.example.comment_oa.response.AjaxResponse;
import com.example.logistics_oa.service.JibenGongzidanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/logisticsOa")
@CrossOrigin
public class JiBenGongZiDanController {
    @Autowired
    JibenGongzidanService jibenGongzidanService;

    @PostMapping("/selectgongzidan/{jibenid}")
    public AjaxResponse selectGongZIDan(@PathVariable("jibenid")String jibenid){
        List<JibenGongzidan> jibenGongzidans = jibenGongzidanService.selectALlGongZiDan(jibenid);
        return AjaxResponse.success(jibenGongzidans);
    }

    @PostMapping("/updateGongZhiDanOne/{jibenZhujian}")
    public AjaxResponse updateGongZhiDanOne(@PathVariable("jibenZhujian")int jibenZhujian){
         jibenGongzidanService.updateGongZhiDanOne(jibenZhujian);
        return AjaxResponse.success();
    }

    @PostMapping("/updateGongZhiDanAll/{jibenId}")
    public AjaxResponse updateGongZhiDanAll(@PathVariable("jibenId")String jibenId){
        jibenGongzidanService.updateGongZhiDanAll(jibenId);
        return AjaxResponse.success();
    }



}
